package com.coin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.coin.domain.UserAuthInfo;
import com.coin.service.UserAuthInfoService;
import com.coin.mapper.UserAuthInfoMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 李力
 * @description 针对表【user_auth_info(实名认证信息)】的数据库操作Service实现
 * @createDate 2025-06-07 10:16:53
 */
@Service
public class UserAuthInfoServiceImpl extends ServiceImpl<UserAuthInfoMapper, UserAuthInfo>
        implements UserAuthInfoService {

    @Override
    public List<UserAuthInfo> getUserAuthInfoByCode(Long authCode) {
        if (authCode == null) {
            throw new RuntimeException("参数为空");
        }
        LambdaQueryWrapper<UserAuthInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper = wrapper.eq(authCode != null, UserAuthInfo::getAuthCode, authCode);
        return list(wrapper);
    }

    @Override
    public List<UserAuthInfo> getUserAuthInfoByUserId(Long id) {
        if (id == null) {
            throw new RuntimeException("参数为空");
        }
        LambdaQueryWrapper<UserAuthInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper = wrapper.eq(id != null, UserAuthInfo::getUserId, id);
        return list(wrapper);
    }
}




